<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
<!--以下是在线编辑器 代码 -->
<style type="text/css">
	.form-control{height:auto;}
	.text-warning input{border:none; width:240px;}
</style>
<?php $myurl="https://".$_SERVER['SERVER_NAME'];?>
<script type="text/javascript">
    /*
	 * 在线编辑器相 关配置 js 
	 *  参考 地址 http://fex.baidu.com/ueditor/
	 */
    window.UEDITOR_Admin_URL = "__ROOT__/Public/plugins/Ueditor/";
    var URL_upload = "{$myurl}{$URL_upload}";
    var URL_fileUp = "{$myurl}{$URL_fileUp}";
    var URL_scrawlUp = "{$myurl}{$URL_scrawlUp}";
    var URL_getRemoteImage = "{$myurl}{$URL_getRemoteImage}";
    var URL_imageManager = "{$myurl}{$URL_imageManager}";
    var URL_imageUp = "{$myurl}{$URL_imageUp}";
    var URL_getMovie = "{$myurl}{$URL_getMovie}";
    var URL_home = "{$myurl}{$URL_home}";
    var URL_Config = "{$myurl}/Admin/Ueditor/getConfig";
</script>
    <script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.all.js"> </script>
    <script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        var ue = UE.getEditor('zp_content', {
            // ... 更多配置
            serverUrl:URL_Config,
            allowDivTransToP:false,
            initialFrameHeight:500
        });
    </script>
    <section class="content">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">           
                <div class="panel-body ">   
                   	<ul class="nav nav-tabs">
                        <foreach name="group_list" item="vo" key="k">
                     		<li <if condition="$k eq 'zhuanpan'">class="active"</if>><a href="javascript:void(0)" data-url="{:U('System/index',array('inc_type'=>$k))}" data-toggle="tab" onclick="goset(this)">{$vo}</a></li>
                     	</foreach>                        
                    </ul>
                    <!--表单数据-->
                    <form method="post" id="handlepost" action="/Admin/System/zhuanpan_post?action=yes">
                        <!--通用信息-->
                    <div class="tab-content" style="padding:20px 0px;">                 	  
                        <div class="tab-pane active" id="tab_smtp">                           
                            <table class="table table-bordered">
                                <tbody>
<!-- 								<tr>
									<td>启用活动：</td>
									<td>
										<input id="turnOn" type="radio"  name="zp_open" <if condition="$config['zp_open'] eq 1">checked</if> value="1" >是 &nbsp; 
										<input type="radio"   name="zp_open" <if condition="$config['zp_open'] eq 0">checked</if> value="0" >否
									</td>
								</tr> -->
								<tr>
								    <td class="col-sm-2">难度：</td>
								    <td class="col-sm-8">
                                        <input type="radio" class="" name="zp_nandu" value="100"<if condition="$zps[0]['zp_nandu'] eq 100"> checked </if> >标准 &nbsp;&nbsp;&nbsp;&nbsp;
                                        <input type="radio" class="" name="zp_nandu" value="1000"<if condition="$zps[0]['zp_nandu'] eq 1000"> checked </if> >中难 &nbsp;&nbsp;&nbsp;&nbsp;
                                        <input type="radio" class="" name="zp_nandu" value="10000"<if condition="$zps[0]['zp_nandu'] eq 10000"> checked </if> >困难 
								    </td>
								</tr>
								<tr>
								    <td class="col-sm-2">礼品：</td> 
								    <td class="col-sm-8">
										<?php
										$j=0;
										for($i=1;$i<9;$i++){
											$pic=empty($zps[$j]['pic']) ? '/Public/images/add-button.jpg' : $zps[$j]['pic'];
										?>
                                        名称：<input type="text" class="input-sm" name="zp_goods{$i}" id="zp_goods{$i}" value="{$zps[$j]['title']}"/> 
										&nbsp;&nbsp;数量：<input type="text" class="input-sm" name="zp_goods_num{$i}" id="zp_goods_num{$i}" value="{$zps[$j]['num']}" style="width: 50px;"/>
										&nbsp;&nbsp;几率：<input type="text" class="input-sm" name="jilv{$i}" id="jilv{$i}" value="{$zps[$j]['jilv']}" style="width: 50px;border: 1px solid red;color: red;"/>
										<a href="javascript:void(0);" onclick="GetUploadify3({$i});"><img class="zp_goods{$i}" src="{$pic}" width="60" height="60"></a>
										<input type="hidden" name="lipin_img{$i}" value="{$zps[$j]['pic']}"/>
                                        （尺寸：60x60 像素）礼品{$i}<br/>
										<?php
										$j++;
										}
										?>
								    </td>
								</tr>
                                <tr>
                                    <td class="col-sm-2">中奖规则：</td>
                                    <td class="col-sm-8">
                         				<textarea class="form-control" id="zp_content" name="zp_content">{$zps[0]['content']}</textarea>
                         				<p class="text-warning">活动描述说明。</p>
                                    </td>
                                </tr>
                                </tbody> 
                                <tfoot>
                                	<tr>
                                	<td><input type="hidden" name="inc_type" value="{$inc_type}"></td>
                                	<td class="text-right"><input class="btn btn-primary" type="button" onclick="adsubmit()" value="保存"></td></tr>
                                </tfoot> 
                                </table>
                        </div>                           
                    </div>              
			    	</form><!--表单数据-->
                </div>
            </div>
        </div>
    </section>
</div>

<script>
var flag = true;
function adsubmit(){
	check_form();
	if(flag){
		$('#handlepost').submit();
	}
}

function check_form(){
	// if($('input[name="smtp_server"]').val() == ''){
	// 	alert('请填写邮件发送服务器地址');
	// 	flag = false;
	// 	return;
	// }
	// if($('input[name="smtp_user"]').val() == '' || !checkEmail($('input[name="smtp_user"]').val())){
	// 	alert('请填写正确的邮箱账号');
	// 	flag = false;
	// 	return;
	// }
	// if($('input[name="smtp_pwd"]').val() == ''){
	// 	alert('请填写发送邮箱密码');
	// 	flag = false;
	// 	return;
	// }
}

$(document).ready(function(){
	get_province();
});

function goset(obj){
	window.location.href = $(obj).attr('data-url');
}
var cur_item_id='';
function GetUploadify3(k){
	cur_item_id=k;
	GetUploadify2(1,'','goods','call_back3');
}

function call_back3(fileurl_tmp){
        $('.zp_goods'+cur_item_id).attr('src',fileurl_tmp); //  修改图片的路径
        $("input[name='lipin_img"+cur_item_id+"'").val(fileurl_tmp); // 输入框保存一下 方便提交
    }

function sendEmail(){
	if($('input[name="test_eamil"]').val() == '' || !checkEmail($('input[name="test_eamil"]').val())){
		alert('请填写正确的测试邮箱账号');
		return;
	}else{
		$.ajax({
			type : "post",
			data : $('#handlepost').serialize(),
			dataType : 'json',
			url : "{:U('System/send_email')}",
			success : function(res){
				if(res==1){
					layer.msg('发送成功', {icon: 1});
				}else{
					layer.msg('发送失败', {icon: 2,time: 2000});
				}
			}
		})
	}
}
</script>
<style type="text/css">
	p{float: none;}
</style>
</body>
</html>